import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { UngroupOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/flow',
    name: 'flow',
    redirect: '/flow/list',
    component: Layout,
    meta: {
      title: '流程管理',
      icon: renderIcon(UngroupOutlined),
      sort: 9,
      permissions: ['flow'],
    },
    children: [
      {
        path: 'flowGroup',
        name: 'flow_flowGroup',
        meta: {
          title: '分组管理',
          permissions: ['flow_flowGroup'],
        },
        component: () => import('@/views/flow/flowGroup/flowGroup.vue'),
      },
      {
        path: 'list',
        name: 'flow_list',
        meta: {
          title: '流程模型',
          permissions: ['flow_list'],
        },
        component: () => import('@/views/flow/flowModel/flowModel.vue'),
      },
      {
        path: 'flowDesign/:id?',
        name: 'flow-design',
        meta: {
          title: '流程设计',
          hidden: true,
        },
        component: () => import('@/views/flow/flowModel/flow.vue'),
      },
      {
        path: 'myFlow',
        name: 'flow_myFlow',
        meta: {
          title: '我的申请',
          permissions: ['flow_myFlow'],
        },
        component: () => import('@/views/flow/myFlow/myFlow.vue'),
      },
      {
        path: 'agencyTasks',
        name: 'flow_agencyTasks',
        meta: {
          title: '待办任务',
          permissions: ['flow_agencyTasks'],
        },
        component: () => import('@/views/flow/agencyTasks/agencyTasks.vue'),
      },
    ],
  },
];

export default routes;
